package com.vader.boot.scope;// 可以引⼊的库和版本相关请参考 “环境说明”
// `ShowMeBug` ⼊⼝类和 `public static void main(String[] args)` ⼊⼝⽅法请勿修改，以防执⾏失败

public class ShowMeBug {
    // 请根据题目要求确定返回值类型和参数列表(输入)
    public int solution(int[] numbers, int b) {
        // 在这⾥书写你的代码
        int i = 0;
        for (; i < numbers.length; i++) {
            int number = numbers[i];
            if (number == b) {
                return i;
            }
        }
        return i;
    }

    // 本题面试官未设置测试用例
    // 请在 main 函数书写自己的测试代码
    public static void main(String[] args) {
        ShowMeBug instance = new ShowMeBug();
        int[] numbers = {1, 3, 4, 5, 8, 8, 8, 11, 18};
        // 测试代码参考示例，请根据题目修改
        int ret = instance.solution(numbers, 2);
        if (ret == 3) {
            System.out.printf("succeed to execute, expected result is 3, got %d", ret);
        } else {
            System.out.printf("failed to execute, expected result is 3, got %d", ret);
        }
    }
}